﻿//Author:Michal Sporna
//License: https://operationsneakpeek.codeplex.com/license

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Screens
{
    public static class Pause
    {
        #region METHODS

        /// <summary>
        /// draw pause screen
        /// </summary>
        public static void Draw()
        {
            try
            {
                Util.Cache.Draw(Util.Cache.GetTexture("PauseScreen").Text2D, new int[] { 0,0,Util.Cache.GraphicsDevice.Viewport.Width, Util.Cache.GraphicsDevice.Viewport.Height }, Color.White);

            }
            catch (Exception ex)
            {
                Util.ErrorLogging.LogError(ex);
                return;
            }
        }

        /// <summary>
        /// checks tap pos
        /// and determines what pause option has been chosen
        /// </summary>
        /// <param name="tap"></param>
        public static void CheckWhichPauseOptionHasBeenChosen(int[] tap)
        {
            try
            {

                if (tap[0] > 230 && tap[0] < 580 && tap[1] > 114 && tap[1] < 176)
                {
                    //resume
                    Util.Cache.SetCurrentScreen(Util.Cache.Screen.ResumedGame);
                }

                if (tap[0] > 230 && tap[0] < 580 && tap[1] > 200 && tap[1] < 273)
                {
                    //options
                    //Util.Cache.SetCurrentScreen(Util.Cache.Screen.ResumedGame);
                }

                if (tap[0] > 230 && tap[0] < 580 && tap[1] > 289 && tap[1] < 352)
                {
                    //exit
                    //delete player isntance
                    Util.Cache.Avatar = null;
                    World.WorldManager.ClearGameWorld();

                    Util.Cache.SetCurrentScreen(Util.Cache.Screen.Menu);
                }

            }
            catch (Exception ex)
            {
                Util.ErrorLogging.LogError(ex);
                return;
            }

        }

        #endregion

    }
}
